import pandas as pd


dataq = pd.read_csv('data/split_results/goods_images_eval_q.csv')
datav = pd.read_csv('data/split_results/goods_images_eval_v.csv')
datao = pd.read_csv('data/split_results/goods_images_eval_o.csv')


images_id = []

for d in dataq['image_id']:
    images_id.append(str(d))

for d in datav['image_id']:
    images_id.append(str(d))

for d in datao['image_id']:
    images_id.append(str(d))

import os
root = '/home/tfj/datasets/image_retri10k/images'
imgs = os.listdir(root)
for img in imgs:
    image_id = img.split('_')[1].split('.')[0]
    images_id.append(image_id)
    
    
sup_data = pd.read_csv('data/goods_id_related_images_filtered.csv')
for d in sup_data['image_id']:
    images_id.append(str(d))


images_id = list(set(images_id))
with open('./used_images_id.txt', 'w') as f:
    for image_id in images_id:
        f.write(f'{image_id}\n')

print(len(images_id))